/*
 * @Author: wangding
 * @Date: 2020-11-09 15:59:20
 * @LastEditTime: 2021-02-19 15:09:44
 * @LastEditors: Please set LastEditors
 * @Description: 抽出i18n国际化，以便于在comm.js内调用
 * @FilePath: \solaxcloud\src\service\lan.js
 */
import Vue from 'vue'
import VueI18n from 'vue-i18n'
import enLocale from 'element-ui/lib/locale/lang/en'
import zhLocale from 'element-ui/lib/locale/lang/zh-CN'
import deLocale from 'element-ui/lib/locale/lang/de'
import itLocale from 'element-ui/lib/locale/lang/it'
import frLocale from 'element-ui/lib/locale/lang/fr'
import nlLocale from 'element-ui/lib/locale/lang/nl'
import ruLocale from 'element-ui/lib/locale/lang/ru-RU'
import esLocale from 'element-ui/lib/locale/lang/es'
import skLocale from 'element-ui/lib/locale/lang/sk'
import ptLocale from 'element-ui/lib/locale/lang/pt-br'
import csLocale from 'element-ui/lib/locale/lang/cs-CZ'
import plLocale from 'element-ui/lib/locale/lang/pl'
import jaLocale from 'element-ui/lib/locale/lang/ja'
import roLocale from 'element-ui/lib/locale/lang/ro'
import fiLocale from 'element-ui/lib/locale/lang/fi'
import trLocale from 'element-ui/lib/locale/lang/tr-TR'
import bgLocale from 'element-ui/lib/locale/lang/bg'
import ElementLocale from 'element-ui/lib/locale'
Vue.use(VueI18n)
const i18n = new VueI18n({
    locale: localStorage.getItem('lang') || 'en_US', // 语言标识
    //this.$i18n.locale // 通过切换 locale 的值来实现语言切换
    messages: {
        'zh_CN': Object.assign(require('./assets/lang/zh_CN.json'), zhLocale), //中文语言包
        'en_US': Object.assign(require('./assets/lang/en_US.json'), enLocale), //英文语言包
        'de_DE': Object.assign(require('./assets/lang/de_DE.json'), deLocale), //英文语言包
        'it_IT': Object.assign(require('./assets/lang/it_IT.json'), itLocale), //英文语言包
        'fr_FR': Object.assign(require('./assets/lang/fr_FR.json'), frLocale), //英文语言包
        'nl_NL': Object.assign(require('./assets/lang/nl_NL.json'), nlLocale), //英文语言包
        'ru_RU': Object.assign(require('./assets/lang/ru_RU.json'), ruLocale), //英文语言包
        'es_ES': Object.assign(require('./assets/lang/es_ES.json'), esLocale), //英文语言包
        'sk_SK': Object.assign(require('./assets/lang/sk_SK.json'), skLocale), //英文语言包
        'pt_BR': Object.assign(require('./assets/lang/pt_BR.json'), ptLocale), //英文语言包
        'cs_CZ': Object.assign(require('./assets/lang/cs_CZ.json'), csLocale), //英文语言包
        'pl_PL': Object.assign(require('./assets/lang/pl_PL.json'), plLocale), //英文语言包
        'ja_JP': Object.assign(require('./assets/lang/ja_JP.json'), jaLocale), //英文语言包
        'ro_RO': Object.assign(require('./assets/lang/ro_RO.json'), roLocale), //英文语言包
        'ka_GE': Object.assign(require('./assets/lang/ka_GE.json'), enLocale), //英文语言包
        'fi_FI': Object.assign(require('./assets/lang/fi_FI.json'), fiLocale), //英文语言包
        'tr_TR': Object.assign(require('./assets/lang/tr_TR.json'), trLocale),
        'bg_BG': Object.assign(require('./assets/lang/bg_BG.json'), bgLocale),
    }
})
ElementLocale.i18n((key, value) => i18n.t(key, value)) //按需导入的elementui组件的国际化，随着i18n改变
export default i18n